# 1、编写一个学生类，产生一堆学生对象
# from faker import Faker
# class Student():
#     def __init__(self):
#         self.name = ""
#         self.sex = ''
#         self.faker = Faker(locale='zh_cn')
#         self.age = 0
#         self.id_card = 0
#         self.phone = 0
#         self.address = ""
#     def get_Student_name(self):
#         self.name = self.faker.name()
#         return f"随机生成的姓名是：{self.name}"
#     def get_Student_id_card(self):
#         self.id_card = self.faker.ssn(min_age=18,max_age=23)
#         self.age = 2023-int(self.id_card[6:10])
#         return f"随机生成的身份证号是：{self.id_card}"
#     def get_Student_age(self):
#         return f"随机生成后的年龄是：{self.age}"
#     def get_Student_sex(self):
#         self.sex = self.faker.random_element(['男','女'])
#         return f"您输入的性别是：{self.sex}"
#     def get_Student_phone(self):
#         self.phone = self.faker.phone_number()
#         return f"随机生成的电话号码是：{self.phone}"
#     def get_Student_address(self):
#         self.address = self.faker.address()
#         return f"随机生成的地址是：{self.address}"
#     def get_Student_information(self):
#         # self.get_Student_name()
#         # self.get_Student_sex()
#         # self.get_Student_age()
#         # self.get_Student_id_card()
#         # self.get_Student_phone()
#         # self.get_Student_address()
#         return self.name,self.sex,self.age,self.id_card,self.phone,self.address
# # student_sex = input("请输入您的性别：")
# p1 = Student()
# for  i in range(10):
#     print(p1.get_Student_name())
#     print(p1.get_Student_id_card())
#     print(p1.get_Student_age())
#     print(p1.get_Student_sex())
#     print(p1.get_Student_phone())
#     print(p1.get_Student_address())
#     print(p1.get_Student_information())
# 2、模仿王者荣耀定义两个英雄类
# class Honor_of_Kings():
#     def __init__(self,Honor_name):
#         self.Honor_name =Honor_name
#     def get_Honor_name(self):
#         return f"姓名是：{self.Honor_name}"
# class Honor_of_Kings_skill_name(Honor_of_Kings):
#     def __init__(self):
#         self.skill1_name = " "
#         self.skill2_name = " "
#         self.skill3_name = " "
#         self.skill4_name = " "
#     def Honor_skill(self,skill1_name,skill2_name,skill3_name,skill4_name):
#         return f"一技能是：{skill1_name}         二技能是：{skill2_name}         三技能是：{skill3_name}         四技能是：{skill4_name}"
# Honor_name = input("请输入英雄名称：")
# p1 = Honor_of_Kings(Honor_name)
# p2 = Honor_of_Kings_skill_name()
# Honor_skill1 = input("请输入第一个技能：")
# Honor_skill2 = input("请输入第二个技能：")
# Honor_skill3 = input("请输入第三个技能：")
# Honor_skill4 = input("请输入第四个技能：")
# print(p1.get_Honor_name())
# print(p2.Honor_skill(Honor_skill1,Honor_skill2,Honor_skill3,Honor_skill4))
# 3、创建一个名为"Person"的类，该类具有"姓名"和"年龄"属性。创建一个"say_hello"方法，当调用该方法时，它会打印出"Hello, 我是[姓名]，今年[年龄]岁。"
# class Person():
#     def __init__(self,name,age):
#         self.name = name
#         self.age = age
#     def say_hello(self):
#         return f"Hello,我是：{self.name}，今年{self.age}岁。"
# person_name = input("请输入姓名：")
# person_age = input("请输入年龄：")
# person1 = Person(person_name,person_age)
# print(person1.say_hello())
# 4、创建一个名为"BankAccount"的类，该类具有"账户名称"和"余额"属性。创建一个"deposit"方法，该方法接受一个参数表示存款金额，
# 并将其添加到余额中。创建一个"withdraw"方法，该方法接受一个参数表示取款金额，并从余额中减去该金额。确保在取款时检查余额是否足够
# class BankAccount():
#     def __init__(self,name):
#         self.user_name = "0"
#         self.balance = 0
#     def deposit(self,balance):
#         self.balance = balance
#         return f"您账户的金额是：{self.balance}元"
#     def withdraw(self,withdraw_money):
#         if withdraw_money > self.balance:
#             return "余额不足!"
#         else:
#             self.balance = self.balance - withdraw_money
#             return self.deposit(self.balance)
#             # return self.balance
# user_name = input("请输入姓名：")
# p1 = BankAccount(user_name)
# balance_money = int(input("请输入要存入的钱数："))
# print(p1.deposit(balance_money))
# balance_money = int(input("请输入要取出的钱数："))
# print(p1.withdraw(balance_money))
# 5、创建一个名为"Student"的类，该类具有"姓名"、"年龄"和"成绩"属性。创建一个"get_grade"方法，
# 该方法接受一个参数表示百分制成绩，并根据得分返回相应的等级（例如，90分以上为"A"级，80-89分为"B"级，70-79分为"C"级，60-69分为"D"级，低于60分为"E"级）
# class Student():
#     def __init__(self,name,age,score):
#         self.name = name
#         self.age = age
#         self.score = score
#     def get_grade(self,score):
#         if self.score >= 90:
#             return "级别为A级"
#         elif self.score < 90 and self.score >=80:
#             return "级别为B级"
#         elif self.score < 80 and self.score >=70:
#             return "级别为C级"
#         elif self.score < 70 and self.score >=60:
#             return "级别为D级"
#         else:
#             return "级别为E级"
# student_name = input("请输入姓名：")
# student_age = input("请输入年龄：")
# student_score = int(input("请输入成绩："))
# p1 = Student(student_name,student_age,student_score)
# print(p1.get_grade(student_score))
# 6、创建一个名为"Car"的类，该类具有"品牌"和"颜色"属性。创建一个"start_engine"方法，该方法打印出"启动汽车引擎！"的消息。
# 创建一个"stop_engine"方法，该方法打印出"关闭汽车引擎！"的消息
# class Car():
#     def __init__(self,brand,colour):
#         self.brand = brand
#         self.colour = colour
#     def start_engine(self):
#         return f"车品牌为：{self.brand}      车颜色为：{self.colour}      启动汽车引擎！"
#     def stop_engine(self):
#         return f"车品牌为：{self.brand}      车颜色为：{self.colour}      关闭汽车引擎！"
# input_brand = input("请输入车品牌名：")
# input_colour = input("请输入车颜色：")
# p1 = Car(input_brand,input_colour)
# print(p1.start_engine())
# print(p1.stop_engine())
# 7、定义一个用户类(User),用户名(username)和密码(password)是这个类的属性。
# # （1）实例化两个用户,分别有不同的用户名和密码。
# # （2）设计一个方法 修改密码
# class User():
#     def __init__(self,username,password):
#         self.username = username
#         self.password = password
#     def user_information(self):
#         return f"用户名是：{self.username}，密码是：{self.password}"
#     def modify_password(self,modify_password):
#         self.password = modify_password
#         return f"用户名是：{self.username}，修改的密码是：{self.password}"
# user_name1 = input("请输入第一个用户名：")
# user_password1 = input("请输入第一个用户的密码：")
# user_name2 = input("请输入第二个用户名：")
# user_password2 = input("请输入第二个用户的密码：")
# p1 = User(user_name1,user_password1)
# print(p1.user_information())
# user_modify_password = input("请输入修改后的密码：")
# print(p1.modify_password(user_modify_password))
# p2 = User(user_name2,user_password2)
# print(p2.user_information())
# 8、有下面的类属性：姓名、年龄、成绩列表[语文，数学，英语]，其中每门课成绩的类型为整数，类的方法如下所述：
# # (1)列表项列表项获取学生的姓名。get_name()，返回类型：str。
# # (2)获取学生的年龄。get_age()，返回类型：int。
# # (3)返回3门科目中最高的分数。get_course()， 返回类型：int。 类定义好之后，可以定义同学测试如下:
# class Student_information():
#     def __init__(self,age,*name,**score):
#         self.name = name
#         self.age = age
#         self.score = score
#     def get_name(self,*name):
#         self.name = name
#         for  i in name:
#             print(f"姓名是：{i},类型是：{type(i)}")
#     def get_age(self):
#         print(f"年龄是：{self.age}")
#     def get_max_score(self):
#         max_score = 0
#         max_score_number = ""
#         for j,i in self.score.items():
#             if int(i) > int(max_score) :
#                 max = i
#                 max_score_number = j
#         print(f"分数最高的学科是：{max_score_number},分数是：{max}")
#         # for  i in self.score:
# user_score1 = {}
# user_age = input("请输入年龄：")
# user_name = input("请输入姓名：")
# for i in range(3):
#     user_score_name = input("请输入您的学科：")
#     user_score = input("请输入此学科的成绩：")
#     user_score1[user_score_name] = user_score
# p1 = Student_information(user_age,user_name,**user_score1)
# p1.get_name(user_name)
# p1.get_age()
# p1.get_max_score()
# 9、淘宝商家后台，可以上架商品、下架商品，功能如下：
# # （1） 可以添加商品，商家添加完的商品会存到商品列表
# # 1.1  商品要有名称、Stock Keeping Unit 库存单位、价格
# # （2） 可以修改商品信息：名称、sku、价格
# # （3） 可以对商品进行下架，下架后的商品不再展示
#
# class TaoBao_background():
#     def __init__(self,commodity_price,commodity_stock_unit):
#         self.commodity_price = commodity_price
#         self.commodity_stock_unit = commodity_stock_unit
#         self.commodity_list_ = []
#         self.commodity_name = ""
#     def add_commodity(self,commodity_name):
#         self.commodity_list_.append(commodity_name)
#         print(self.commodity_list_)
#     def delete_commodity(self,commodity_name):
#         for  i in self.commodity_list_:
#             if i == commodity_name:
#                 self.commodity_list_.remove(i)
#         print(self.commodity_list_)
#     def modify_commodity(self,commodity_name):
#         for  i in self.commodity_list_:
#             if i == commodity_name:
#                 new_commodity_id = self.commodity_list_.index(i)
#                 new_commodity_nem = input("请输入您修改后的名称：")
#                 self.commodity_list_[new_commodity_id] = new_commodity_nem
#                 self.commodity_price = input("请输入您要修改的价格：")
#                 self.commodity_stock_unit = input("请输入您要修改的库存单位：")
#                 print(f"修改后的名称：{new_commodity_nem},价格：{self.commodity_price},库存单位：{self.commodity_stock_unit}")
#                 break
#             else:
#                 print("您输入的商品不存在！")
#                 break
# p1 = TaoBao_background(20,"瓶")
# while True:
#     comm = input("请输入名称：")
#     if comm == "0":
#         break
#     p1.add_commodity(comm)
# # print(p1.select_commodity())
# while True:
#     comm_de = input("请输入要删除的名称：")
#     if comm_de == "0":
#         break
#     p1.delete_commodity(comm_de)
# comm_mo = input("请输入要修改的名称：")
# p1.modify_commodity(comm_mo)